<div class="crumb-wrap">
    <div class="crumb-list"> <i class="icon-font"></i>
        <a href="/think/admin">首页</a>
        <span class="crumb-step">&gt;</span>
        <span class="crumb-name">系统设置</span>
    </div>
</div>
<div class="result-wrap">
    <form action="<?=site_url('config/update')?>" method="post" id="myform" name="myform">
        <div class="config-items">
            <div class="config-title">
                <h1> <i class="icon-font">&#xe00a;</i>
                    网站信息设置
                </h1>
            </div>
            <div class="result-content">
                <table width="100%" class="insert-tab">
                    <tbody>
                        <tr>
                            <th width="15%">
                                <i class="require-red">*</i>
                                站点标题：
                            </th>
                            <td>
                                <input type="text" id="" value="<?=$res->title?>" size="85" name="title" class="common-text"></td>
                        </tr>
                        <tr>
                            <th>
                                <i class="require-red">*</i>
                                联系邮箱：
                            </th>
                            <td>
                                <input type="text" id="" value="<?=$res->email?>" size="85" name="email" class="common-text">
                                <span>当有订单的时候会发送邮件到该邮箱</span>
                            </td>
                        </tr>

                        <tr>
                            <th>
                                <i class="require-red">*</i>
                                用户推广介绍：
                            </th>
                            <td>
                                <input class="common-text" name="article_title" size="50" value="<?=$article['title']?>" type="text" readonly="readonly" style="background:#f4f3f1">
                                <a href="javascript:;" class="btn btn-primary mr10" onclick="open_view('<?=site_url('article/show?aid='.$article['id'])?>')">查看</a>
                                <a href="javascript:;" class="btn btn-primary mr10" onclick="show_article()">选择文档</a>
                                <a href="<?=site_url('article/create')?>" target="_blank">没有？ 点击这里创建一个</a>
                            </td>
                        </tr>
                        <tr>
                            <th>
                                <i class="require-red">*</i>
                                站点状态：
                            </th>
                            <td>
                                <select name="status" id="catid" class="required">
                                    <option value="2" title="只允许超级管理员进入" <?=$res->status == 2 ? 'selected' : '';?>>关闭</option>
                                    <option value="1" <?=$res->status == 1 ? 'selected' : '';?>>开启</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <th></th>
                            <td>
                                <!-- 用户推广介绍 -->
                                <input type="hidden" name="article_id" value="<?=$article['id']?>">
                                <input type="submit" value="提交" class="btn btn-primary btn6 mr10">
                                <input type="button" value="返回" onclick="history.go(-1)" class="btn btn6"></td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </form>
</div>

<script type="text/javascript">
    function show_article(){
        layer.open({
            type: 2,
            area: ['800px', '600px'],
            fix: false, //不固定
            maxmin: true,
            title:'文档选择',
            content: "<?=site_url('article/choice')?>"
        });
    }

    function open_view(url){
        layer.open({
            type: 2,
            area: ['800px', '600px'],
            fix: false, //不固定
            maxmin: true,
            content: url
        });
    }

    $('#myform').submit(function() {
        var index = layer.load(2);
        $(this).ajaxSubmit(function(data){
            layer.close(index);
            if(data == 1){
                layer.alert("操作成功！",{
                    icon:1,
                },function(){
                    location.href='<?=site_url("config/index")?>';
                });
            }else{
                layer.alert(data,{
                    icon:2,
                });
            }
        })
        return false;
    })
</script>